package com.sds.shop.action;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.sds.fw.mvc.Action;
import com.sds.fw.mvc.HttpUtil;
import com.sds.shop.dao.MemDAO;
import com.sds.shop.vo.MemVO;

public class ModifyMemAction extends Action {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		HttpSession session = request.getSession();
		request.setCharacterEncoding("euc-kr");
		String memId=(String)session.getAttribute("memId");
		MemDAO dao = MemDAO.getInstance();
		MemVO vo = new MemVO();
		
		vo = dao.getCustomer(memId);
		vo.setPwd(request.getParameter("pwd"));
		vo.setPwdHint(request.getParameter("pwdhint"));
		vo.setPwdHintAns(request.getParameter("pwdhintans"));
		vo.setMemNm(request.getParameter("name"));
		vo.setBirthDt(request.getParameter("birthdt"));
		vo.setMaleFlg(request.getParameter("sex"));
		vo.setTelNo(request.getParameter("telno"));
		vo.setCellNo(request.getParameter("cellno"));
		vo.setAddr(request.getParameter("addr"));
		vo.setEmail(request.getParameter("email"));
		
		dao.modifyUser(vo);
		
		
		HttpUtil.redirect(response, "list.do");

	}

}
